package com.example.demo03.web;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo03.entity.response.TodoItemAPI;

/**
 *
 * @author [Your Name]
 * @version 1.0
 * @since [Date]
 */
@RestController
@RequestMapping("/api/test")
public class TestController {

	@GetMapping("/test")
	public ResponseEntity<TodoItemAPI> getById(@PathVariable Long id) {
		TodoItemAPI todoItem = new TodoItemAPI();
		if (todoItem.getId() == null) {
			throw new RuntimeException();
		}
		return todoItem != null ? new ResponseEntity<>(todoItem, HttpStatus.OK)
				: new ResponseEntity<>(HttpStatus.NOT_FOUND);
	}

}